﻿using System;
using System.Numerics;

class CalculateNK
{
    static BigInteger Factoriel(int number)
    {
        BigInteger fac = 1;
        for (int i = 1; i <= number; i++)
        {
            fac *= i;
        }
        return fac;
    }


    static void Main()
    {
        BigInteger nFac = 1;
        BigInteger kFac = 1;
        Console.Write("5. Write a program that calculates N!*K! / (K-N)! for given N and K ");
        Console.ForegroundColor = ConsoleColor.Red;
        Console.WriteLine("(1<N<K)\n");
        Console.ForegroundColor = ConsoleColor.White;
        Console.Write("Enter N :");
        int n = int.Parse(Console.ReadLine());
        Console.Write("Enter K :");
        int k = int.Parse(Console.ReadLine());

        if (n < 1 || n > k)
        {
            Console.WriteLine("Incorrect values!");
        }
        else
        {
            Console.WriteLine("Result is: {0}", (Factoriel(n) * Factoriel(k)) / (Factoriel(k - n)));

        }

    }
}

